class BoardView:
    def __init__(self):
        split_line = '------------------------------------'
        split2_pre = ' '
        split2_after = ' |   |   |   |   |   |   |   |   |'
        self.__map_view = ['   | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |', split_line]
        for i in range(0, 8):
            c = chr(65 + i)
            self.__map_view.append(split2_pre + c + split2_after)
        self.__map_view.append(split_line)

    # 转换成字符串
    def to_string(self) -> str:
        return '\n'.join(self.get_map_view())

    # 更新点的状态
    def update(self, point, new_status) -> None:
        x, y = point.get_x(), point.get_y()
        x += 1
        y = 5 + 4 * (y - 1)
        self.get_map_view()[x] = self.get_map_view()[x][:y] + new_status + self.get_map_view()[x][y + 1:]

    # 得到map_view
    def get_map_view(self) -> list:
        return self.__map_view
